package edu.ptu.communityplatform.config;

import edu.ptu.communityplatform.interceptor.AuthInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @BelongsProject: communityPlatform
 * @BelongsPackage: edu.ptu.community platform.config
 * @Author: HYJ
 * @CreateTime: 2025-04-04  17:42
 * @Description: TODO
 * @Version: 1.0
 */
@Configuration
@Import({MPConfig.class})
@MapperScan("edu.ptu.communityplatform.mapper")
public class SpringConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器并指定拦截路径
        registry.addInterceptor(new AuthInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/person/login");
    }
}
